package cn.dlc.com.filter;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.exception.ZuulException;
import org.springframework.stereotype.Component;

@Component
public class MyErrorFilter extends ZuulFilter {

    @Override
    public String filterType() {
        // 异常过滤器
        return "error";
    }

    @Override
    public int filterOrder() {
        return 1;
    }

    @Override
    public boolean shouldFilter() {
        //
        System.out.println("error filter");
        // 启用当前过滤器
        return true;
    }

    @Override
    public Object run() throws ZuulException {
        System.out.println("error filter run....");
        return null;
    }
}
